#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QDialog>
#include <QMessageBox>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //u/*i->actionnew->setIcon(QIcon("C:/Users/86156/Desktop/QT projects/Sourse/Image/image1.jpg"));
    //ui->actionopen->setIcon(QIcon("C:\\Users\\86156\\Desktop\\QT projects\\Sourse\\Image\\image2.jpg"));*/
    ui->actionnew->setIcon(QIcon(":/Image/image1.jpg"));
    ui->actionopen->setIcon(QIcon(":/Image/image2.jpg"));
    connect(ui->actionnew, &QAction::triggered, [=]() {
//        QDialog dialog(this);
//        dialog.exec();
//        qDebug() << "对话框弹出" ;

        //非模块对话框
//        QDialog *dialog = new QDialog(this);
//        dialog->show();
//        dialog->setAttribute(Qt::WA_DeleteOnClose); //自动释放空间
//        qDebug() << "对话框弹出";

        //错误对话框
     //   QMessageBox::critical(this, "critical", "错误");
        //消息对话框
   //     QMessageBox::information(this, "info", "信息");
        //提问对话框
//        if(QMessageBox::Save ==  QMessageBox::question(this, "question", "提问", QMessageBox::Save | QMessageBox::Cancel, QMessageBox::Save)) {
//            qDebug() << "文件已经保存";
//        } else {
//            qDebug() << "保存已将取消";
//        }
        QMessageBox::warning(this, "warning", "警告");
    });
}

MainWindow::~MainWindow()
{
    delete ui;
}

